<!--#include file="../Inc/conn.asp"-->
<!--#include file="../Inc/md5.asp"-->
<%
dim adminname,adminpwd,adminip

if request("action")="adminlogin" then
adminname	=CheckStr(trim(Request.form("adminname")))
adminpwd	=CheckStr(trim(Request.form("adminpwd")))
adminpwd	=Mid(md5("laoy"&adminpwd,32),11,19)
adminRndPassword	=md5("l"&"a"&"o"&"yadmin"&RndNumber(1,9999999999),32)

mycode = trim(request.form("code"))
	if adminname="" or adminpwd="" then
	Call Alert("请输入用户名和密码！",-1)
	end if
	if mycode<>Session("getcode") then
	Call Alert("请输入正确的验证码！",-1)
	end if
	
set rs=server.createobject("ADODB.Recordset")
sql="select * from ["&tbname&"_Admin] where Admin_Name='"&adminname&"' and Admin_Pass='"&adminpwd&"'"
rs.open sql,conn,1,3
If Not rs.Eof Then 
   Session("YaoContent")=""
   Response.Cookies("LaoYAdmin").path=SitePath
   Response.Cookies("LaoYAdmin")("UserID")=rs("ID")
   Response.Cookies("LaoYAdmin")("UserPass")=rs("Admin_Pass")
   Response.Cookies("LaoYAdmin")("UserName")=rs("Admin_Name")
   Response.Cookies("LaoYAdmin")("AdminRndPass")=adminRndPassword
   'Response.Cookies("LaoYAdmin").Expires=Date+1
   rs("Admin_Time")		= Now
   rs("Admin_IP")		= GetIP
   rs("AdminRndPass")	= adminRndPassword			 
   rs.update
   response.Redirect "Index.asp"
else	
   Call Alert("您输入的用户名或密码不正确！",-1)
end if
rs.close
set rs=nothing

end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=sitetitle%>-管理员登陆</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
body,td {margin:0;padding:0;color:#528311;font-size:12px;}
body {background:#A3D862;}
td img {display: block;}
form,input {margin:0;padding:0;}
.lyform {border:1px solid #CADCB2;height:17px;}
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td style="background:url(images/login1.jpg) left 1px repeat-x;"><table width="1003" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="images/spacer.gif" width="261" height="1" border="0" alt="" /></td>
        <td><img src="images/spacer.gif" width="231" height="1" border="0" alt="" /></td>
        <td><img src="images/spacer.gif" width="53" height="1" border="0" alt="" /></td>
        <td><img src="images/spacer.gif" width="81" height="1" border="0" alt="" /></td>
        <td><img src="images/spacer.gif" width="66" height="1" border="0" alt="" /></td>
        <td><img src="images/spacer.gif" width="68" height="1" border="0" alt="" /></td>
        <td><img src="images/spacer.gif" width="243" height="1" border="0" alt="" /></td>
        <td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
      </tr>
      <tr>
        <td colspan="7">&nbsp;</td>
        <td><img src="images/spacer.gif" width="1" height="173" border="0" alt="" /></td>
      </tr>
      <tr>
        <td rowspan="5">&nbsp;</td>
        <td colspan="5"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/t2_r1_c1.jpg" width="102" height="72" />            </td>
            <td><img src="images/t2_r1_c2.jpg" width="53" height="72" /></td>
            <td><img src="images/t2_r1_c3.jpg" width="82" height="72" /></td>
            <td><img src="images/t2_r1_c4.jpg" width="135" height="72" /></td>
            <td><img src="images/t2_r1_c5.jpg" width="72" height="72" /></td>
            <td><img src="images/t2_r1_c6.jpg" width="55" height="72" /></td>
          </tr>
        </table></td>
        <td rowspan="5">&nbsp;</td>
        <td><img src="images/spacer.gif" width="1" height="72" border="0" alt="" /></td>
      </tr>
      <tr>
        <td rowspan="3" background="images/login_r3_c2.jpg">&nbsp;</td>
        <td colspan="4" rowspan="2" background="images/login_r3_c3.jpg">
        <form name="form1" method="post" action="?action=adminlogin" target="_top">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="108" background="images/login_r3_c3.jpg"><table width="200" border="0" cellspacing="0" cellpadding="0" style="margin-top:10px;">
              <tr>
                <td width="77" height="25" align="center">用户名</td>
                <td width="123" colspan="2"><input name="AdminName" type="text" class="lyform" id="AdminName" style="width:100px;" /></td>
              </tr>
              <tr>
                <td height="25" align="center">密　码</td>
                <td colspan="2"><input name="adminpwd" type="password" class="lyform" id="adminpwd" style="width:100px;" /></td>
              </tr>
              <tr>
                <td height="25" align="center">验证码</td>
                <td><input name="code" type="text" class="lyform" id="code" size="5" maxlength="5"/></td>
                <td><img src="../Inc/code.asp" border="0" alt="看不清楚请点击刷新验证码" style="cursor : pointer;width:78px;height:18px;" onclick="this.src='../Inc/code.asp?y='+Math.random()"/></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><img src="images/login_r4_c3.jpg" width="53" height="22" /></td>
                <td><input type="image" src="images/login_r4_c4_r1_c1.jpg" width="40" height="22" name="button" id="button" value="提交" /></td>
                <td><img src="images/login_r4_c4_r1_c2.jpg" width="41" height="22" onClick="document.form1.reset()" style="cursor:pointer;"/></td>
                <td><img src="images/login_r4_c5.jpg" width="66" height="22" /></td>
                <td><img src="images/login_r4_c6.jpg" width="68" height="22" /></td>
              </tr>
            </table></td>
          </tr>
        </table>
        </form>
        </td>
        <td><img src="images/spacer.gif" width="1" height="108" border="0" alt="" /></td>
      </tr>
      <tr>
        <td><img src="images/spacer.gif" width="1" height="22" border="0" alt="" /></td>
      </tr>
      <tr>
        <td colspan="4" valign="top" background="images/login_r5_c3.jpg" style="padding-top:27px;">老Y文章管理系统 <%=version%></td>
        <td><img src="images/spacer.gif" width="1" height="231" border="0" alt="" /></td>
      </tr>
      <tr>
        <td colspan="5"><img name="login_r6_c2" src="images/login_r6_c2.jpg" width="499" height="7" border="0" id="login_r6_c2" alt="" /></td>
        <td><img src="images/spacer.gif" width="1" height="7" border="0" alt="" /></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>